<?php
# 导入数据库接口文件
require_once 'dr-app-config.php';
require_once 'dr-app-functions.php';

require_once 'dr-db-options.php';

# 获得用户的请求
$action = isset($_POST['action']) ? $_POST['action'] : '';
//$action = 'get_general_settings';
switch ($action) {
	case 'get_general_settings':
		echo dr_get_general_settings();
		break;

	case 'update_general_settings':
		echo dr_update_general_settings();
		break;

	default:
		echo '';
}

function dr_get_general_settings()
{
	$result = dr_db_get_general_settings();
	return json_encode($result);
}

function dr_update_general_settings()
{
	$options = json_decode($_POST['options'], true);

	$result = dr_db_update_general_settings($options);
	if ($result) {
		return '{"ret":1}';
	}
	return '{"ret":0}';
}